package top.lyunk.demo.flink.streaming;

import org.apache.flink.api.common.serialization.SimpleStringSchema;
import org.apache.flink.connector.kafka.source.KafkaSource;
import org.apache.flink.connector.kafka.source.enumerator.initializer.OffsetsInitializer;

import java.util.Properties;

public class FlinkKafkaUtils {

    public static KafkaSource<String> getKafkaEventSource() {
        return KafkaSource.<String>builder()
                .setBootstrapServers("192.168.56.35")
                .setTopics("input-topic")
                .setGroupId("my-group")
                .setStartingOffsets(OffsetsInitializer.earliest())
                .setValueOnlyDeserializer(new SimpleStringSchema())
                .build();
    }

    private static Properties prop() {
        return null;
    }
}
